package ch.usi.inf.pf2.editor;

import java.awt.Color;

import ch.usi.inf.pf2.Sheet;
import ch.usi.inf.pf2.cell.Cell;
import junit.framework.TestCase;
/**
 * 
 * @author Lorenzo Baracchi <lorenzo.baracchi@usi.ch>
 *
 */
public class TestChangeCellColor extends TestCase
{
    private Sheet s;
    private Cell c;
    private ChangeCellColor chcb;
    
    protected void setUp()
    {
	   s= new Sheet();
	   s.initializeSheet();
	   c=s.getCell(1, 1);
	   c.setColor(Color.RED);
	   chcb = new ChangeCellColor(s, 1, 1, Color.BLUE);
    }
    
    public void testEvaluate ()
    {
	   chcb.evaluate();
	   assertEquals(Color.RED, chcb.getOldColor());
	   assertEquals(Color.BLUE, chcb.getNewColor());
	   assertEquals(Color.BLUE, c.getColor());
    }
    
    public void testRestore ()
    {
	   chcb.evaluate();
	   chcb.restore();
	   assertEquals(Color.RED, chcb.getOldColor());
	   assertEquals(Color.BLUE, chcb.getNewColor());
	   assertEquals(Color.RED, c.getColor());
    }
}
